//
//  UIView+ViewController.swift
//  SinaSwift
//
//  Created by Yan on 16/4/4.
//  Copyright © 2016年 baidu. All rights reserved.
//

import UIKit

extension UIView {
//    func navController() -> UINavigationController? {
//        var next = nextResponder()
//        while next != nil {
//           if let nav = next as? UINavigationController {
//                return nav
//            }
//            next = next?.nextResponder()
//        }
//        return nil
//    }

    func navController() -> UINavigationController? {
        var next = nextResponder()
        while next != nil {
            if let nav = next as? UINavigationController {
                return nav
            }
            next = next?.nextResponder()
        }
        return nil
    }
}